% 
% @(#)Integer.m	1.1  3/6/87
%
export _IntegerObject to "Builtins"

const _IntegerObject == immutable object _IntegerObject
  export getSignature, create
  const IntegerType == immutable type IntegerType
    function + [o : Integer] -> [r : Integer]
      % r <- self + o
    function - [o : Integer] -> [r : Integer]
      % r <- self - o
    function * [o : Integer] -> [r : Integer]
      % r <- self * o
    function / [o : Integer] -> [r : Integer]
      % r <- self / o
    function # [o : Integer] -> [r : Integer]
      % r <- self % o
    function > [o : Integer] -> [r : Boolean]
      % r <- self > o
    function >= [o : Integer] -> [r : Boolean]
      % r <- self >= o
    function < [o : Integer] -> [r : Boolean]
      % r <- self < o
    function <= [o : Integer] -> [r : Boolean]
      % r <- self <= o
    function = [o : Integer] -> [r : Boolean]
      % r <- self = o
    function != [o : Integer] -> [r : Boolean]
      % r <- self != o
    function asString -> [r : String]
      % s is set to a string with no leading 0's, decimal rep.
    function ~ -> [r : Integer]
      % r <- negate self
    function asReal -> [ r : Real ]
      % r <- self as a real
  end IntegerType
  function getSignature -> [result : Signature]
    result <- IntegerType
  end getSignature
  function create [rep : String] -> [result : IntegerType]
    result <- immutable object anInteger
      export +, -, *, /, #, >, >=, <, <=, =, !=, asString, ~, asReal
      function + [o : Integer] -> [r : Integer]
	primitive 006 [r] <- [o]
      end +
      function - [o : Integer] -> [r : Integer]
	primitive 106 [r] <- [o]
      end -
      function * [o : Integer] -> [r : Integer]
	primitive 206 [r] <- [o]
      end *
      function / [o : Integer] -> [r : Integer]
	primitive 306 [r] <- [o]
      end /
      function # [o : Integer] -> [r : Integer]
	primitive 406 [r] <- [o]
      end #
      function > [o : Integer] -> [r : Boolean]
	primitive 506 [r] <- [o]
      end >
      function >= [o : Integer] -> [r : Boolean]
	primitive 606 [r] <- [o]
      end >=
      function < [o : Integer] -> [r : Boolean]
	primitive 706 [r] <- [o]
      end <
      function <= [o : Integer] -> [r : Boolean]
	primitive 806 [r] <- [o]
      end <=
      function = [o : Integer] -> [r : Boolean]
	primitive 906 [r] <- [o]
      end =
      function != [o : Integer] -> [r : Boolean]
	primitive 1006 [r] <- [o]
      end !=
      function asString -> [r : String]
	primitive 1106 [r] <- []
      end asString
      function ~ -> [r : Integer]
	primitive 1206 [r] <- []
      end ~
      function asReal -> [r : Real]
	primitive 1306 [r] <- []
      end asReal
    end anInteger
  end create
end _IntegerObject
